package asteroids.model.programs.parsing.statements;

import java.util.List;
import java.util.Map;

import be.kuleuven.cs.som.annotate.Basic;

import asteroids.model.programs.parsing.expressions.*;
import asteroids.model.programs.parsing.types.Type;

import asteroids.model.Ship;

/**
 * A class of print statements.
 * 
 * @author Thijs Dieltjens - Wim Konings
 * @version 2.0
 */
public class Print extends Statement {

	public Print (Expression e,int line, int column){
		super(line, column);
		this.expressionToPrint = e;
	}

	@Basic
	public Expression getExpressionToPrint() {
		return expressionToPrint;
	}

	private Expression expressionToPrint;

	@Override
	public void execute(Ship ship) {
		System.out.println(getExpressionToPrint().toString(ship));
	}

	@Override
	public List<String> getTypeCheckErrors(List<String> errors, Map<String, Type> globals) {
		errors = getExpressionToPrint().getTypeCheckErrors(errors, globals);
		return errors;
	}

	@Override
	public boolean containsActionStatement() {
		return false;
	}
}
